<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<spring:url value="/js/candidato/studicompiuti.js" var="jsUrl"></spring:url>
<script src="${jsUrl}" type="text/javascript"></script>
<div class="unit-row">
	<div class="unit-70" style="width:100%;opacity:0.7;background-color:#FFFFFF;font-weight:bold;">
		<nav class="nav-tabs" style="width:1000px">
			<ul>
				<li><a href="${flowExecutionUrl}&_eventId=dati-anagrafici">Dati anagrafici</a></li>
				<li><span>Contatti</span></li>				
				<li><a href="${flowExecutionUrl}&_eventId=opportunita-azienda">Opportunit&agrave;</a></li>	
				<li><a href="<c:url value="j_spring_security_logout" />">Logout</a></li>
			</ul>
		</nav>
		<br />
		<c:if test="${not empty datiContattiSalvati}">
			<div class="message message-success">
				<span class="close"></span> Dati salvati con successo!
			</div>
		</c:if>
		<c:if
			test="${not empty requestScope['org.springframework.validation.BindingResult.contattoAzienda'].allErrors}">
			<div class="message message-error">
				<span class="close"></span> Sono presenti degli errori!
			</div>
		</c:if>
		<br>

		<h4 id="toc-base" class="head-toc head-toc-start">Contatti Aziendali</h4>
		<p>
		<table class="width-80 table-bordered table-hovered" style="margin:auto">
			<thead>
				<tr>
					<th class="width-20">Tipologia</th>
					<th class="width-30">Valore</th>
					<th class="width-10">&nbsp;</th>
				</tr>
			</thead>
			<tbody>
				<c:if test="${fn:length(contattiForm.contatti) == 0}">
					<tr>
						<td colspan="4">
							<p>
								<strong>Non sono presenti contatti</strong>
						</td>
					</tr>
				</c:if>
				<c:if test="${fn:length(contattiForm.contatti) > 0}">
					<c:forEach var="contatto" items="${contattiForm.contatti}">
						<tr>
							
							<td><c:out value="${contatto.tipoContatto}"></c:out></td>
							<td><c:out value="${contatto.valoreContatto}"></c:out></td>
							<td class="handle">
								<spring:url value="/images/" var="images"></spring:url>
								<a
								href="${flowExecutionUrl}&_eventId=modificaContatto&idContattoDaModificare=${contatto.idContatto}">
									<img alt="Modifica contatto"
									src="${images}/glyphicons_150_edit.png" border="0" />
							</a> &nbsp; <a
								href="${flowExecutionUrl}&_eventId=eliminaContatto&idContattoDaCancellare=${contatto.idContatto}">
									<img alt="Elimina contatto"
									src="${images}/glyphicons_016_bin.png" border="0" />
							</a></td>

						</tr>
					</c:forEach>
				</c:if>
			</tbody>
		</table>
		<br />
		<form:form id="contattiAzienda" method="post"
			action="${flowExecutionUrl}" commandName="contattiForm"
			cssClass="forms forms-columnar">
			
			<form:hidden path="contattoEditato.idContatto" />
			
			<fieldset>
				<legend>
					<c:if test="${ empty contattiForm.contattoEditato.idContatto}">Nuovo </c:if>
					<c:if test="${ not empty contattiForm.contattoEditato.idContatto }">Modifica </c:if>
					contatto
				</legend>
				<p class="forms-inline">
					<form:label path="contattoEditato.tipoContatto" cssErrorClass="error">Quale tipo di contatto? <em
							class="req">*</em>
					</form:label>
					<form:select id="tipoContatto"
						path="contattoEditato.tipoContatto" cssClass="width-30" maxlength="50"
						cssErrorClass="input-error width-30">
						<form:option value="">Seleziona un tipo di contatto</form:option>
						<form:option value="email">Email</form:option>
						<form:option value="tel">Telefono</form:option>
						<form:option value="mobile">Mobile</form:option>
						<form:option value="fax">Fax</form:option>
					</form:select>
					<form:errors path="contattoEditato.tipoContatto" cssClass="error"></form:errors>
				</p>
				<p class="forms-inline">
					<p class="forms-inline">
					<form:label path="contattoEditato.valoreContatto" cssErrorClass="error">Valore <em class="req">*</em></form:label>
					<form:input path="contattoEditato.valoreContatto" cssClass="width-30" maxlength="50"
						cssErrorClass="input-error width-30" />
					<form:errors path="contattoEditato.valoreContatto" cssClass="error"></form:errors>
				</p>			

				<p align="right">
					<input type="hidden" name="_eventId" value="saveContatto">
					<input type="reset" class="btn" value="Annulla"> <input
						type="submit" class="btn" value="Salva contatto">
				</p>
			</fieldset>
		</form:form>
	</div>
</div>
